import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'


class City extends Component {


  handleClick = () => {
    //编程式导航
    this.props.history.push(this.props.path)
  }

  render() {
    return (
      <li className={this.props.path === this.props.location.pathname ? 'selected':''} onClick={this.handleClick}>
        城市
      </li>
    )
  }

  componentDidMount() {
    console.log(this.props)
  }

}

export default withRouter(City)